<html>

<head>
    <script>
        var dojoConfig = {
            paths: {
                "olesk": "/olesk"
            }
        };
    </script>

    <script type="text/javascript"
            src="/dj/dojo/dojo.js"
            data-dojo-config="isDebug:true">
    </script>

    <script type="text/javascript">

    require(["olesk/widgets/TwitterMessage/TwitterMessageWidget",
            "doh",
            "dojo/query",
            "dojo/dom-class",
            "dojo/dom",
            "dojo/dom-construct",
            "dojo/domReady!"], 
            function (TwitterMessageWidget, doh, query, domClass, dom, domConstruct) {

    	doh.register("layout", [
    	    {
    	    	name: "text_in_place",
    	    	setUp: function () {
    	    		domConstruct.empty("arena");
    	    	},
    	    	tearDown: function () {
    	    		domConstruct.empty("arena");
    	    	},
    	    	runTest: function () {
    	    		var twitWidget =  new TwitterMessageWidget({
    	    			text: "trololo",
    	    			time: "Wed Apr 11 17:50:17 +0000 2012"
    	    		});
    	    		twitWidget.placeAt(dom.byId('arena'));
    	    		
    	    		doh.assertEqual("trololo", 
    	    				  query('.b-twitter-message__text')[0].innerHTML);
    	    	}
    	    },
    	    {
                name: "time_in_place",
                setUp: function () {
                    domConstruct.empty("arena");
                },
                tearDown: function () {
                    domConstruct.empty("arena");
                },
                runTest: function () {
                    var twitWidget = new TwitterMessageWidget({
                        text: "trololo",
                        time: "Wed Apr 11 17:50:17 +0000 2012"
                    });
                    twitWidget.placeAt(dom.byId('arena'));
                    
                    doh.assertEqual("Wed Apr 11 17:50:17 +0000 2012", 
                    		query('.b-twitter-message__time')[0].innerHTML);
                }
            },
    	    {
                name: "time_defaults_to_nothing",
                setUp: function () {
                    domConstruct.empty("arena");
                },
                tearDown: function () {
                    domConstruct.empty("arena");
                },
                runTest: function () {
                    var twitWidget = new TwitterMessageWidget({
                        text: "trololo"
                    });
                    twitWidget.placeAt(dom.byId('arena'));
                    
                    doh.assertEqual("", query('.b-twitter-message__time')[0].innerHTML);
                }
            },
    	]);
    	
        doh.run();
    });
    </script>
</head>
<body>
    <div id="arena"></div>
</body>
</html>
